/**
 * There are <a href="https://github.com/thinkgem/jeesite">JeeSite</a> code generation
 */
package com.chlitina.store.modules.sms.entity;

import javax.persistence.CascadeType;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.Id;
import javax.persistence.IdClass;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToOne;
import javax.persistence.Table;
import javax.validation.constraints.NotNull;

import org.hibernate.annotations.Cache;
import org.hibernate.annotations.CacheConcurrencyStrategy;
import org.hibernate.annotations.NotFound;
import org.hibernate.annotations.NotFoundAction;

import com.chlitina.store.common.persistence.BaseEntity;
import com.chlitina.store.modules.base.entity.Customer;

/**
 * 店面群发短信详情Entity
 * 
 * @author lvbo
 * @version 2013-07-11
 */
@Entity
@IdClass(SmsStoreGroupLogDetailPK.class)
@Table(name = "sms_store_group_log_detail")
@Cache(usage = CacheConcurrencyStrategy.READ_WRITE)
public class SmsStoreGroupLogDetail extends BaseEntity {

	private static final long serialVersionUID = 1L;
	private SmsStoreGroupLog smsStoreGroupLog; // 短信日志
	private Customer customer; // 客户
	private int customerType; //会员类型	0：会员短信（可发多条，均需有会员编号）	1：散客，非会员（仅发一条，不需要有detail的会员编号记录）

	public SmsStoreGroupLogDetail() {
	}

	@Id
	@OneToOne(cascade = { CascadeType.REFRESH }, fetch = FetchType.LAZY)
	@JoinColumn(name = "ssgl_id")
	@NotFound(action = NotFoundAction.IGNORE)
	@Cache(usage = CacheConcurrencyStrategy.READ_WRITE)
	@NotNull
	public SmsStoreGroupLog getSmsStoreGroupLog() {
		return smsStoreGroupLog;
	}

	public void setSmsStoreGroupLog(SmsStoreGroupLog smsStoreGroupLog) {
		this.smsStoreGroupLog = smsStoreGroupLog;
	}

	@Id
	@ManyToOne(cascade = { CascadeType.REFRESH }, fetch = FetchType.LAZY)
	@JoinColumn(name = "customer_id")
	@NotFound(action = NotFoundAction.IGNORE)
	@Cache(usage = CacheConcurrencyStrategy.READ_WRITE)
	@NotNull
	public Customer getCustomer() {
		return customer;
	}

	public void setCustomer(Customer customer) {
		this.customer = customer;
	}

	public int getCustomerType() {
		return customerType;
	}

	public void setCustomerType(int customerType) {
		this.customerType = customerType;
	}

}
